package work.parabola.keyboardswitch.pojo.query;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import work.parabola.keyboardswitch.common.ServerResponse;

@Data
public class LoginQuery {

    private String username;

    private String password;

    public ServerResponse validate(){
        if (StringUtils.isBlank(this.username)) {
            return ServerResponse.createByErrorMessage("用户名不能为空");
        }
        if(StringUtils.isBlank(this.password)){
            return ServerResponse.createByErrorMessage("密码不能为空");
        }

        return ServerResponse.createBySuccess();
    }
}
